package org.vnl.platform.orm;

import org.vnl.platform.dk.util.PDKRuntimeException;
import org.vnl.platform.dk.util.SEVERITY;

/**
 * 執行Transaction時發生錯誤的Exception
 * 
 * @author Vaughan
 *
 */
public class TransactionException extends PDKRuntimeException {

    /**
     * 
     */
    private static final long serialVersionUID = 8596310546473738325L;
    
    public static final String ORM_SYSTEM_ID = "ORMS";
    public static final String DEFAULT_BUNDLE_NAME = "resource.org.vnl.platform.orm.ORMS";


    public TransactionException() {
        super();
    }

    public TransactionException(String systemId, String msg, String severity, Object[] parameters, Throwable cause) {
        super(systemId, msg, severity, parameters, cause);
    }
    
    public TransactionException(String msg, Throwable cause) {
        super(ORM_SYSTEM_ID,msg,SEVERITY.EXCEPTION.toString(), null, cause);
    }
    
    public TransactionException(String msg) {
        super(ORM_SYSTEM_ID,msg,SEVERITY.EXCEPTION.toString(), null, null);
    }
    
    public TransactionException(String msg, String severity) {
        super(ORM_SYSTEM_ID, msg, severity, null, null);
    }
    
    public TransactionException(String msg, String severity, Throwable cause) {
        super(ORM_SYSTEM_ID, msg, severity, null, cause);
    }
    
    public TransactionException(String msg, String severity, Object[] parameters) {
        super(ORM_SYSTEM_ID, msg, severity, parameters, null);
    }
    
    public TransactionException(String msg, String severity, Object[] parameters, Throwable cause) {
        super(ORM_SYSTEM_ID, msg, severity, parameters, cause);
    }
    
    public TransactionException(String msg, Object[] parameters) {
        super(ORM_SYSTEM_ID, msg, SEVERITY.EXCEPTION.toString(), parameters, null);
    }
    
    public TransactionException(String msg, Object[] parameters, Throwable cause) {
        super(ORM_SYSTEM_ID, msg, SEVERITY.EXCEPTION.toString(), parameters, cause);
    }
    
    public TransactionException(TransactionErrCode cod) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), null, null);
    }
    
    public TransactionException(TransactionErrCode cod, Throwable cause) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), null, cause);
    }
    
    public TransactionException(TransactionErrCode cod, Object[] parameters) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), parameters, null);
    }
    
    public TransactionException(TransactionErrCode cod, Object[] parameters, Throwable cause) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), parameters, cause);
    }
    
    public TransactionException(ORMEnvCode cod) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), null, null);
    }
    
    public TransactionException(ORMEnvCode cod, Throwable cause) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), null, cause);
    }
    
    public TransactionException(ORMEnvCode cod, Object[] parameters) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), parameters, null);
    }
    
    public TransactionException(ORMEnvCode cod, Object[] parameters, Throwable cause) {
        super(ORM_SYSTEM_ID, cod.toString(), cod.getSeverityString(), parameters, cause);
    }

    @Override
    protected String getDefaultBundleName() {
        return DEFAULT_BUNDLE_NAME;
    }
}
